#!/usr/bin/perl -w

use strict;
use warnings;

use Test::More 'no_plan';

use Lono::Parser::Ingredient;

my $pi = Lono::Parser::Ingredient->new;
isa_ok( $pi, 'Lono::Parser::Ingredient' );

ok(try_amount("3 cups of flour") eq '3');
ok(try_amount("2.5 ounces of barley") eq '2.5');
ok(try_amount("Pinch of sugar") eq 'Pinch');
ok(try_amount("1 3/4 cups of flour") eq '1 3/4');
ok(try_amount("3 5-ounce cans of tomato sauce") eq '3');

sub try_amount {
    my $text = shift;
    my $result = $pi->parse($text);
    return $result->{'amount'};
}

